import { ResPage, ReqPage } from '@/api/interface'
import { TBY } from '@/api/config/servicePort'
import http from '@/api'

/**自然教育广场 */
export namespace EducationSquare {
  export interface Query extends ReqPage {
    name?: string
  }

  export interface Record {
    /**主键id */
    id: number
    /**名称*/
    name: string
    /**面积 */
    area: number
    /**经度*/
    longitude: string
    /**维度*/
    latitude: number
  }

  export interface Form {
    /**主键id */
    id: number
    /**名称*/
    name: string
    /**面积 */
    area: number
    /**经度*/
    longitude: string
    /**维度*/
    latitude: number
    /**简介 */
    content: string
  }
}

export const pageEducationSquare = (params: EducationSquare.Query) => {
  return http.get<ResPage<EducationSquare.Record>>(TBY + `/education_square/page`, params)
}

// 详情
export const getEducationSquareDetail = (id: number) => {
  return http.get<Partial<EducationSquare.Form>>(TBY + `/education_square/get`, { id }, { loading: false })
}

// 新增或修改
export const saveOrUpdateEducationSquare = (params: Partial<EducationSquare.Form>) => {
  return http.post(TBY + `/education_square/save`, params)
}

// 删除
export const removeEducationSquare = (id: number) => {
  return http.delete(TBY + `/education_square/delete`, { id })
}

// 列表
export const listEducationSquare = (params: EducationSquare.Query) => {
  return http.get<EducationSquare.Record[]>(TBY + `/education_square/list`, params)
}
